			google.maps.visualRefresh = true;
			window.loc = function(str, callback) {
    			cordova.exec(callback, function(err) {
        			callback('Could not retrieve locations.');
    			}, "LocationPlugin", "location", [str]);
			};
			
			window.clearLoc = function(str, callback) {
    			cordova.exec(callback, function(err) {
        			callback('Could not clear.');
    			}, "LocationPlugin", "clear", [str]);
			};
			
			window.fire = function(poss) {

				//initialize map options
				var mapOptions = {
					center: new google.maps.LatLng(14.5498065, 121.0457386),
					zoom: 12,
					mapTypeId: google.maps.MapTypeId.ROADMAP
				};
				
				//initialize map instance
				var map = new google.maps.Map(document.getElementById("map-canvas"),
					mapOptions);
					
				for(var i=0;i<poss.length;i++){
					var posHolder = new google.maps.LatLng(poss[i].x, poss[i].y);
					var marker = new google.maps.Marker({
					  position: posHolder,
					  map: map,
					  title: "Marker " + i,
					});
				}
			
			}
			
			function initialize() {
				window.callEcho();
			}
			google.maps.event.addDomListener(window, 'load', initialize);
			function callEcho(){
      			window.loc("", function(locations) {
					$('#inner').empty();
					var posArray = [];
					for(var i=0;i<locations.length;i++){
						var obj = locations[i].split(',');
						var coor = new Object();
						coor.x = obj[0];
						coor.y = obj[1];
						posArray.push(coor);
					}
					
					fire(posArray);
					alert (locations.length);
				});
				
				
			};
			
			function callClear(){
				window.clearLoc("", function(locations) {
				var posArray = [];	
				fire(posArray);
				});
			};
			
			